package leetcode_周赛._2021._202112._12;

import java.util.ArrayList;
import java.util.List;

/**
 * @author yzh
 * @version 1.0
 * @date 2021/12/12 10:34
 */
public class _5952 {
    public static void main(String[] args) {
        System.out.println(new _5952().countPoints("B0B6G0R6R0R6G9"));
    }

    public int countPoints(String rings) {
        ArrayList<Character>[] lists = new ArrayList[10];
        for (int i = 0; i < rings.length(); i += 2) {
            int index = Integer.parseInt(rings.charAt(i + 1) + "");
            if (lists[index] == null) {
                lists[index] = new ArrayList<>();
            }
            lists[index].add(rings.charAt(i));
        }
        int ans = 0;
        for (int i = 0; i < 10; i++) {
            List<Character> list = lists[i];
            if (list == null) continue;
            if (list.contains('R') && list.contains('G') && list.contains('B')) ++ans;
        }
        return ans;
    }

}
